package kr.co.doriclassic.powerjava.chapter10;

import java.io.BufferedReader;

import javax.swing.JOptionPane;

public class ArrayTest {
	public static void main(String[] args) {
		final int STUDENT = 5;
		int total = 0;
		
		
		int[] arrScore = new int[STUDENT];
		System.out.println("arrScore의 길이"+arrScore.length);
		
		
		for(int i=0;i<arrScore.length;i++){
			//wrapper class 문자 -> 숫자
			//String res =JOptionPane.showInputDialog("점수입력");
			//arrScore[i] = Integer.parseInt(res);
			//arrScore[i] = Integer.parseInt(JOptionPane.showInputDialog("점수를 입력하시오"));
			arrScore[i] = i+1;
		}
		/*prnArr(arrScore);
		arrSum(arrScore);*/
		
		//arrScore[STUDENT]=10;
		int[] arr ={1,2,3,4,5,6,7,8,9};
		System.out.println("arr의 갯수"+arr.length);
		//for each문은 출력용으로만 사용가능하다. 수정이나 입력이 불가능
		for (int i : arr) {
			System.out.printf("%3d",i);
		}
	}
	private static void arrSum(int[] arrScore) {
		int sum=0;
		
		for (int i = 0; i < arrScore.length; i++) {
			sum = sum+arrScore[i];
		}
		System.out.println("벼열 arrScore의 합은 "+sum);
	}
	private static void prnArr(int[] arrScore) {
		for(int i=0;i<arrScore.length;i++){
			System.out.println(arrScore[i]+"\t");
		}
		System.out.println();
	}
}
